<template>
  <div class="topBox">
    <div class="L" style="display: flex;"><img src="/assets/images/booklogo.png">二手图书商城</div>
    <div class="R">
      <RouterLink to="business/address/map"><img src="/assets/images/map.png"></RouterLink>
    </div>
  </div>
  <div class="clear"></div>
  <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
    <van-swipe-item v-for="item in hotlist">
      <van-image fit="cover" :src="item.thumbs_text" />
    </van-swipe-item>
  </van-swipe>
  <div class="clear"></div>
  <div class="lqgwBox">
    <ul>
      <li><RouterLink to="/product/index"><img src="/assets/images/quanbu.png">
          <p>全部书籍</p>
        </RouterLink></li>
      <li><RouterLink to="/coupon/index"><img src="/assets/images/youhui.png">
          <p>优惠活动</p>
        </RouterLink></li>
      <li><RouterLink to="/typelist/ranking"><img src="/assets/images/bandan.png">
          <p>榜单排行</p>
        </RouterLink></li>
      <li><a href="live.html"><img src="/assets/images/zibo.png">
        <p>敬请期待</p>
      </a></li>
    </ul>
  </div>
  <div class="clear"></div>
  <div class="contitbox">
    <p>二手<span>•</span>好书</p>
  </div>
  <div class="clear"></div>
  <ul class="proul">
    <li v-for="item in newlist">
      <div class="con">
        <RouterLink :to="{path: '/product/info', query: {proid: item.id}}">
          <img :src="item.thumbs_text">
          <p>{{ item.name }}<span>￥</span>{{ item.price }}</p>
        </RouterLink>
      </div>
    </li>
  </ul>
  <div class="clear"></div>
  <div class="h54"></div>
  <div class="clear"></div>
  <Footer />
</template>
<script setup>
import Footer from '@/components/common/footer.vue'
import { reactive } from 'vue'
onBeforeMount(() => {
  getHomeData()
})
const hotlist = ref([])
let newlist = ref([])
const getHomeData = async()=>{
  let result = await Api.productIndex();
  if(result.code == 1)
  {
    hotlist.value = result.data.hotlist
    newlist.value = result.data.newlist
    console.log(hotlist.value)
  }
}
</script>